<?php
/**
 * Portal admin page
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: PortalAdminPage.php 368 2010-02-06 20:23:50Z steen.rabol@gmail.com $
 * @package Pradoportal.Common
 */

Prado::using('Application.Common.PortalSystemPage');

/**
 * Base page for pages used in the administrtion interface
 *
 * @package Pradoportal.Common
 */
class PortalAdminPage extends PortalSystemPage
{
	public function onPreInit($param)
	{
		parent::onPreInit($param);

		$this->Theme		= "Admin/Default";
		$this->MasterClass	= 'Application.Layouts.Admin.Default.AdminLayout';

		if(!$this->User)
		{
			$this->reportError(1, Prado::localize("You need to be logged in to use this page"));
		}

		if($this->User->RoleId != $this->Application->Parameters['AdminRole'])
		{
			$this->reportError(1, Prado::localize("You don't have access to this page"));
		}
	}

	public function gotoDefaultPage()
	{
		$this->Response->redirect($this->Service->constructUrl('Admin.Home'));
	}

	public function setAdminPageTitle($pageName = null)
	{
		$title = $this->Application->Parameters['SiteTitle'].' ';
		$title .= Prado::localize('Administration');
		$title .= $pageName !== null ? ' - ' . $pageName : '';

		$this->Title = $title;
	}
}
?>